package com.hm.common.autoconfigure;

import com.hm.common.plugin.oss.OssCloudFactory;
import com.hm.common.su.CommonDef;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.io.Serializable;

/**
 * @author shishun.wang
 * @version 1.0
 * @date 2019/4/2 17:17
 * @describe
 */
@Data
@ConfigurationProperties(CommonDef.PROPERTIES_CONFIG_PREFIX)
public class CommonProperties implements Serializable {
	
	private Plugin plugin = new Plugin();

	private Swagger swagger = new Swagger();

	@Data
	public class Swagger implements Serializable{
		private String basePackage;
		private String title;
		private String version;
		private String description;
		private String license;
		private String licenseUrl;
	}
	
	@Data
	public class Plugin implements Serializable {
		private OssCloudConfig ossCloudConfig = new OssCloudConfig();
		private NettyConfig netty = new NettyConfig();
		
		@Data
		public class OssCloudConfig implements Serializable {
			private OssCloudFactory.OssCloudType cloudType;
			private String accessKey;
			private String secretKey;
			private String bucket;
			private String baseUri;
		}
		
		@Data
		public class NettyConfig implements Serializable {
			private int port = 8899;
			private int bossGroupCount = 1;
			private int workerGroupCount = 3;
			private boolean keepAlive = true;
			private int backlog = 1024;
		}
	}
}
